package com.blog.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.blog.pojo.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    /**
     * 根据用户名查询用户全部数据
     * @param username
     * @return
     */

    @Select("select * from user where username = #{username}")
    User getByUsername(String username);

    /**
     * 数据插入、新增数据
     * @param user
     */
    @Insert("insert into user(username, password, nickname, user_avatar, create_time, update_time) " +
            "values" +
            "(#{username},#{password},#{nickname},#{userAvatar},#{createTime},#{updateTime})")
    void savaUser(User user);

    void update(User user);
}
